package com.ninthgroup.controller;

import com.ninthgroup.entity.Condition;
import com.ninthgroup.entity.MessageBooking;
import com.ninthgroup.service.ConditionService;
import com.ninthgroup.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/condition")
public class ConditionController {
    @Autowired
    private ConditionService conditionService;

    //查询全部
    @RequestMapping("/list")
    public Result list(){
       return conditionService.selectAll();
    }
//        添加
    @RequestMapping("/add")
    @ResponseBody
    public Result add(@RequestBody Condition condition){
        return conditionService.insertAdd(condition);
    }


    //修改
    @RequestMapping("/update")
    @ResponseBody
    public Result update(@RequestBody Condition condition){

        return conditionService.update(condition);
    }

//    删除
    @RequestMapping("/del")
    public Result del(Integer cId){
        return conditionService.del(cId);
    }


    @PostMapping("/updateAdvise")
    public Result updateAdvise(@RequestBody Condition condition){
       return conditionService.updateOneAdvise(condition);
    }


    @GetMapping("/one")
    public Result selectOne(Integer cId){
        return conditionService.selectOne(cId);
    }
}
